﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/MainForm.master" AutoEventWireup="true" CodeFile="BookManager.aspx.cs" Inherits="Views_BookManager" %>

<asp:Content ID="Content1" ContentPlaceHolderID="header" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="Title" Runat="Server">
Books Manager
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ContentRight" Runat="Server">
<p style="font-size:xx-large">Notification</p>
<asp:Repeater runat="server" ID="rptDiary">
    <HeaderTemplate>
        <table border="0">
    </HeaderTemplate>
    <ItemTemplate>
        <tr>
            <td><%#Eval("Yourname") %></td>
            <td>Muốn trao đổi quyển sách </td>
            <td><%#Eval("MyBook") %></td>
            <td>của bạn bằng</td>
            <td><%#Eval("YourBook") %></td>
            <td><%#Eval("MoneyRoot") %></td>
            <td>và</td>
            <td><%#Eval("MoneyAdd") %></td>
            <td>với lời nhắn</td>
            <td><%#Eval("Message") %></td>
        </tr>
    </ItemTemplate>
    <FooterTemplate>
        </table>
    </FooterTemplate>
</asp:Repeater>
<asp:Repeater runat="server" ID="rptBooks" DataSourceID="sqlDsBooks">
    <HeaderTemplate>
        <table border="1" frame="box">
        <tr align="center" style="font-size:16px">
            <td >Image</td>
            <td>Title</td>
            <td>Author</td>
            <td>Category</td>
            <td>Public Year</td>
            <td>Purpose of sell</td>
            <td>Price</td>
        </tr>
    </HeaderTemplate>
    <ItemTemplate>
        <tr>
            <td><asp:Image runat="server" ImageUrl='<%# "../Images/"+Eval("Image")%>' Height="100"/></td>
            <td><%#Eval("Title") %>></td>
            <td><%#Eval("Author") %>></td>
            <td><%#Eval("CategoryName") %>></td>
            <td><%#Eval("PublicationYear") %></td>
            <td><%#Eval("PurposeOfSelling")%></td>
            <td><%#Eval("SellingPrice")%></td>
            <td><a href='DeleteBook.aspx?BookId=<%#Eval("ID") %>' >Delete</a></td>
            <td><a href='EditBook.aspx?BookId=<%#Eval("ID") %>' >Edit</a></td>
        </tr>
    </ItemTemplate>
    <FooterTemplate>
        </table>
        <br />
        <br />
        <a href="NewBook.aspx" style="font-size:14px">Add new book</a>
    </FooterTemplate>
</asp:Repeater>
    <asp:SqlDataSource ID="sqlDsBooks" runat="server" 
        ConnectionString="<%$ ConnectionStrings:conStr %>" 
        ProviderName="<%$ ConnectionStrings:conStr.ProviderName %>" 
        SelectCommand="SELECT Book.ID, Book.Title, Book.Author, Book.Description, Category.CategoryName, Book.PublicationYear, Book.PurposeOfSelling, Book.SellingPrice, Book.Image FROM Book INNER JOIN Category ON Book.CategoryID = Category.ID Where UserID=@UserID">
        <SelectParameters>
            <asp:SessionParameter Name="UserID" SessionField="UserID" />
        </SelectParameters>
    </asp:SqlDataSource>
</asp:Content>
